
/**
 * Write a description of class SimpleFilters here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class SimpleFilters
{
    private Image target;
    
    public SimpleFilters(Image I){
        target = I;
        
        if(target == null){
            System.out.println("Error, no image set");
        }
    }
    
    public void brighten(int factor){
        for(Pixel p : target.getPixels()){
            p.setValue(p.getValue() + factor);
        }
    }
    public void darken(int factor){
        for(Pixel p : target.getPixels()){
            p.setValue(p.getValue() - factor);
        }
    }
    
    public void invert(){
        for(Pixel p : target.getPixels()){
            p.setValue(255 - p.getValue());
        }
    }
    public void solarize(){
        for(Pixel p : target.getPixels()){
            int pixelValue = p.getValue();
            if(pixelValue < 127){
                p.setValue(255 - pixelValue);
            }
        }
    }
}
